home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 4
/
Aminet 4 - November 1994.iso
/
aminet
/
util
/
gnu
/
gnuplot_3_5.lha
/
gnuplot
/
termdjsvga.trm
< prev
next >
Wrap
Text File
|
1993-09-16
|
3KB
|
130 lines
/*
* $Id: djsvga.trm%v 3.50 1993/07/09 05:35:24 woo Exp $
*/
/* GNUPLOT - djsvga.trm */
/*
* Copyright (C) 1992
*
* Permission to use, copy, and distribute this software and its
* documentation for any purpose with or without fee is hereby granted,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation.
*
* Permission to modify the software is granted, but not the right to
* distribute the modified code. Modifications are to be distributed
* as patches to released version.
*
* This software is provided "as is" without express or implied warranty.
*
* This file is included by ../term.c.
*
* This terminal driver supports:
* svga
*
* AUTHORS
* Russell Lang
*
* send your comments or suggestions to (info-gnuplot@dartmouth.edu).
*
*/
/* SVGA driver using DJGPP */
#include <graphics.h>
#include <pc.h>
int dj_startx, dj_starty;
int dj_xlast, dj_ylast;
int dj_color;
#define DJSVGA_XMAX 640
#define DJSVGA_YMAX 480
#define DJSVGA_XLAST (DJSVGA_XMAX - 1)
#define DJSVGA_YLAST (DJSVGA_YMAX - 1)
#define DJSVGA_VCHAR 16
#define DJSVGA_HCHAR 8
#define DJSVGA_VTIC 4
#define DJSVGA_HTIC 4
#define DJNUMCOLOR 15
static int svga256color[DJNUMCOLOR] = {7,8,2,3,4,5,9,14,12,15,13,10,11,1,6};
static int dj_colors[DJNUMCOLOR];
DJSVGA_init()
{
int i, on, r, g, b;
/* Allocate colors */
for (i=0; i<DJNUMCOLOR; i++) {
on = svga256color[i] & 8 ? 255 : 170;
r = svga256color[i] & 4 ? on : 0;
g = svga256color[i] & 2 ? on : 0;
b = svga256color[i] & 1 ? on : 0;
if (svga256color[i] == 8) r=g=b=85;
dj_colors[i] = GrAllocColor(r,g,b);
}
/* Get the screen size: */
GrSetMode(GR_default_graphics,0,0); /* */
dj_xlast = GrMaxX();
term_tbl[term].xmax = dj_xlast + 1;
dj_ylast = GrMaxY();
term_tbl[term].ymax = dj_ylast + 1;
GrSetMode(GR_default_text,0,0); /* */
}
DJSVGA_graphics()
{
GrSetMode(GR_default_graphics,0,0);
}
DJSVGA_text()
{
(void)getkey();
GrSetMode(GR_default_text,0,0);
}
DJSVGA_reset()
{
int i;
/* Free colors */
for (i=0; i<DJNUMCOLOR; i++) {
GrFreeColor(dj_colors[i]);
}
}
DJSVGA_linetype(linetype)
int linetype;
{
if (linetype >= 13)
linetype %= 13;
dj_color = dj_colors[linetype+2];
}
DJSVGA_move(x,y)
unsigned int x,y;
{
dj_startx = x;
dj_starty = y;
}
DJSVGA_vector(x,y)
unsigned int x,y;
{
GrLine(dj_startx,dj_ylast-dj_starty,x,dj_ylast-y,dj_color);
dj_startx = x;
dj_starty = y;
}
DJSVGA_put_text(x,y,str)
unsigned int x, y;
char *str;
{
GrTextXY(x,dj_ylast-y-DJSVGA_VCHAR/2,str,dj_color,GrNOCOLOR);
}